package com.ybear.ybutils.utils.dialog;

import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

public class Create<V extends View> {
    private int width;
    private int height;
    private V layout;
    private ViewGroup.LayoutParams lp;
    private boolean isFree = false;

    public Create(@NonNull V view) {
        this( view, null );
    }
    public Create(@NonNull V view, @Nullable ViewGroup.LayoutParams lp) {
        layout = view;
        this.lp = lp;
    }
    public Create(@NonNull V view, int width, int height) {
        layout = view;
        this.width = width;
        this.height = height;
    }

    public int getWidth() { return width; }
    public Create setWidth(int width) {
        this.width = width;
        return this;
    }

    public int getHeight() { return height; }
    public Create setHeight(int height) {
        this.height = height;
        return this;
    }

    public V getLayout() { return layout; }
    public Create setLayout(V layout) {
        this.layout = layout;
        return this;
    }

    public ViewGroup.LayoutParams getLayoutParams() { return lp; }
    public Create setLayoutParams(ViewGroup.LayoutParams lp) {
        this.lp = lp;
        return this;
    }

    public boolean isFree() { return isFree; }
    public Create<V> setFree(boolean free) {
        isFree = free;
        return this;
    }
}